<?php
namespace app\common\validate;
use think\Validate;
class Featured extends Validate {
    protected $rule = [
        ['id','number'],
        ['title','require|max:30','标题必须填写|标题不能超过30个字符'],
        ['image','require','请上传推荐图'],
        ['url','require','链接地址必须填写'],
        ['description','require','描述必须填写'],
        ['type','number','请选择所属分类'],
        ['listorder','number'],
        ['status','number|in:-1,0,1','状态必须是数字|状态范围不合法'],
    ];

    // 场景设置
    protected  $scene = [
        'add' => ['name', 'title','image','url','description','type','id'],
        'listorder'=>['id','listorder'],
        'status' =>['id','status'],
    ];
}